Skip to content

feat(hooks): import reviewed Claude and Codex commands - #1840

Merged
limityan merged 3 commits into
GCWing:mainfrom
limityan:yanzhn/hook-import-design
Jul 29, 2026
Merged

feat(hooks): import reviewed Claude and Codex commands#1840
limityan merged 3 commits into
GCWing:mainfrom
limityan:yanzhn/hook-import-design

Conversation

@limityan

@limityan limityan commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add explicit preview/apply/update management for the supported synchronous command Hook subset from Claude Code and Codex across root CLI, interactive TUI, and Desktop settings.
  • Keep AgentHookEngine as the only executor. Ecosystem adapters discover and prepare; core owns plan/apply fencing; the service store owns private managed snapshots.
  • Unify native, discovered, and imported Hook status under bitfun hooks / /hooks, with old external-Hook commands retained only as aliases.

Product and architecture boundaries

  • Import is always explicit and command-visible before apply; source files are never modified.
  • User and workspace imports remain independently managed with enable, disable, update, remove, and corrupt-store reset actions.
  • OpenCode Hooks, non-command or asynchronous handlers, generic Hook Runtime, Plugin Runtime integration, startup import, file watching, Remote/Peer execution, and scheduler/agent-loop changes are intentionally excluded.
  • Imported layers reuse the existing native Hook parser, execution engine, event ordering, timeout, audit, and next-event cache reload behavior.
  • Process-only docs/superpowers/** material is excluded; durable behavior and ownership constraints stay in the existing architecture and feature documents.

User experience

  • Desktop uses one review dialog and existing settings controls; TUI uses numbered /hooks actions; root CLI retains the exact fingerprint only where cross-process non-interactive confirmation requires it.
  • GUI/TUI do not expose the internal fingerprint. Initial import and update use distinct confirmation copy, and completion messages reflect disabled imports and the global Hook switch accurately.
  • The project-file gate is labeled as the project Hook file so it is not confused with independently reviewed project imports.
  • Refresh is explicit and asynchronous. No startup import, file watcher, or automatic replay is introduced.

Safety and failure handling

  • Plans are bound to the redacted catalog revision and exact prepared command/assets fingerprint; stale actions fail without automatic replay.
  • Private snapshots enforce file/count/depth/byte budgets, no-follow managed paths, per-store cross-process locking, content-digest verification, and fail-closed corrupt or tampered bundles.
  • Runtime engine rebuilds verify each exact managed bundle once and pass the same verified hooks.json bytes to the native parser; an earlier validity bit cannot authorize newly read commands.
  • Bundle publication stages and validates first, rolls back on index publication failure, and removes retired snapshots after a successful commit on a best-effort path.
  • Updates preserve the authoritative enabled/disabled state, and all user-facing surfaces report that state instead of implying that a disabled import became active.
  • Unsupported or ambiguous source semantics remain visible as skipped/unsupported diagnostics and never silently become executable.

Validation

  • cargo check --workspace
  • cargo test -p bitfun-services-integrations --no-default-features --features hook-import hook_import (13 passed)
  • cargo test -p bitfun-cli hook --no-default-features (19 passed)
  • pnpm --dir src/web-ui run test:run src/infrastructure/config/components/HooksConfig.test.tsx (6 passed)
  • Focused Claude Code, Codex, parser, coordinator, core/native Hook, desktop API, CLI/TUI, and Web UI tests
  • pnpm run type-check:web
  • pnpm run i18n:contract:test
  • pnpm run i18n:audit
  • pnpm run lint:web
  • node scripts/check-core-boundaries.mjs
  • pnpm run check:repo-hygiene
  • git diff --check
  • Context-isolated adversarial review findings fixed, followed by a final scope and UX audit of the updated paths

CI is intentionally not awaited for this draft.

limityan added 3 commits July 29, 2026 03:11
Revalidate managed Hook content before rebuilding the native engine and reuse the verified bytes for parsing. Report preserved disabled imports accurately in both CLI surfaces.
Remove process-only superpowers documents from the PR, keep the durable integrity rule in the owned architecture document, and make CLI/TUI/Desktop confirmation and state messaging reflect the actual Hook gates without exposing internal fingerprints.
@limityan
limityan marked this pull request as ready for review July 29, 2026 01:18
@limityan
limityan merged commit 908b019 into GCWing:main Jul 29, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant